package com.volkanic.thread;

import com.badlogic.gdx.Gdx;
import com.volkanic.game.BlueMoonGame;
import com.volkanic.views.View;

/**
 * Created by Lucas on 27/07/2014.
 */
public class ActingThread extends MainThread {

    /**
     * Debugging tag
     */
    private final String TAG = "ActingThread";
    /**
     * Interval of time between two actions in millisecond
     */
    private final long interval = 20;

    /**
     * Initialize a new instance of the class ActingThread
     * @param game
     */
    public ActingThread(BlueMoonGame game){
        super(game);
        Gdx.app.debug(TAG, "Creation");
    }

    @Override
    public void run() {
        while(_isRunning) {
            try {
                this.sleep(interval);
                if (_game != null){
                    View view = _game.getView();
                    if (view != null){
                        view.stagesAct();
                    }
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
